/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package cw.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author VinhTC
 */
@Entity
@Table(name = "tblPuzzleSize")
@NamedQueries({
    @NamedQuery(name = "PuzzleSize.findAll", query = "SELECT p FROM PuzzleSize p"),
    @NamedQuery(name = "PuzzleSize.findBySizeId", query = "SELECT p FROM PuzzleSize p WHERE p.sizeId = :sizeId"),
    @NamedQuery(name = "PuzzleSize.findBySizeName", query = "SELECT p FROM PuzzleSize p WHERE p.sizeName = :sizeName"),
    @NamedQuery(name = "PuzzleSize.findByRowSize", query = "SELECT p FROM PuzzleSize p WHERE p.rowSize = :rowSize"),
    @NamedQuery(name = "PuzzleSize.findByColSize", query = "SELECT p FROM PuzzleSize p WHERE p.colSize = :colSize"),
    @NamedQuery(name = "PuzzleSize.findByStatus", query = "SELECT p FROM PuzzleSize p WHERE p.status = :status")})
public class PuzzleSize implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "SizeId")
    private Integer sizeId;
    @Basic(optional = false)
    @Column(name = "SizeName")
    private String sizeName;
    @Basic(optional = false)
    @Column(name = "RowSize")
    private int rowSize;
    @Basic(optional = false)
    @Column(name = "ColSize")
    private int colSize;
    @Basic(optional = false)
    @Column(name = "Status")
    private boolean status;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "puzzleSize")
    private List<Puzzle> puzzleList;

    public PuzzleSize() {
    }

    public PuzzleSize(Integer sizeId) {
        this.sizeId = sizeId;
    }

    public PuzzleSize(Integer sizeId, String sizeName, int rowSize, int colSize, boolean status) {
        this.sizeId = sizeId;
        this.sizeName = sizeName;
        this.rowSize = rowSize;
        this.colSize = colSize;
        this.status = status;
    }

    public Integer getSizeId() {
        return sizeId;
    }

    public void setSizeId(Integer sizeId) {
        this.sizeId = sizeId;
    }

    public String getSizeName() {
        return sizeName;
    }

    public void setSizeName(String sizeName) {
        this.sizeName = sizeName;
    }

    public int getRowSize() {
        return rowSize;
    }

    public void setRowSize(int rowSize) {
        this.rowSize = rowSize;
    }

    public int getColSize() {
        return colSize;
    }

    public void setColSize(int colSize) {
        this.colSize = colSize;
    }

    public boolean getStatus() {
        return status;
    }

    public void setStatus(boolean status) {
        this.status = status;
    }

    public List<Puzzle> getPuzzleList() {
        return puzzleList;
    }

    public void setPuzzleList(List<Puzzle> puzzleList) {
        this.puzzleList = puzzleList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (sizeId != null ? sizeId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PuzzleSize)) {
            return false;
        }
        PuzzleSize other = (PuzzleSize) object;
        if ((this.sizeId == null && other.sizeId != null) || (this.sizeId != null && !this.sizeId.equals(other.sizeId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "cw.entity.PuzzleSize[sizeId=" + sizeId + "]";
    }

}
